<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>邀请好友 - 模切材料小程序</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        :root {
            /* TDesign 工业品色彩系?*/
            --primary-color: #0052d9;
            --primary-light: #266fe8;
            --primary-dark: #003cab;
            --secondary-color: #f2f3ff;
            --accent-color: #e37318;
            --success-color: #00a870;
            --warning-color: #ed7b2f;
            --error-color: #d54941;
            
            /* 背景色系 */
            --bg-color-page: #f5f7fa;
            --bg-color-container: #ffffff;
            --bg-color-secondray: #f8f9fc;
            
            /* 边框和分割线 */
            --border-color: #e7e7e7;
            --border-color-light: #f0f0f0;
            --border-radius-small: 3px;
            --border-radius-medium: 6px;
            --border-radius-large: 9px;
            
            /* 文字色彩 */
            --text-primary: #1a1a1a;
            --text-secondary: #4e5969;
            --text-placeholder: #86909c;
            --text-disabled: #c9cdd4;
            
            /* 阴影系统 */
            --shadow-1: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
            --shadow-2: 0 1px 4px 0 rgba(0, 0, 0, 0.08);
            --shadow-3: 0 4px 8px 0 rgba(0, 0, 0, 0.12);
            
            /* 间距系统 */
            --space-1: 4px;
            --space-2: 8px;
            --space-3: 12px;
            --space-4: 16px;
            --space-5: 20px;
            --space-6: 24px;
            --space-8: 32px;
            --space-10: 40px;
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
        }
        
        body {
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
            color: var(--text-primary);
            font-size: 14px;
            line-height: 1.5;
            min-height: 100vh;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }
        
        .container {
            max-width: 480px;
            margin: 0 auto;
            min-height: 100vh;
            position: relative;
            overflow-x: hidden;
        }
        
        /* 头部样式 */
        .header {
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            padding: var(--space-4);
            position: relative;
            z-index: 10;
        }
        
        .top-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: var(--space-4);
        }
        
        .back-btn {
            font-size: 18px;
            cursor: pointer;
            color: white;
            opacity: 0.9;
            transition: opacity 0.2s ease;
        }
        
        .back-btn:hover {
            opacity: 1;
        }
        
        .page-title {
            font-weight: 500;
            font-size: 16px;
            color: white;
        }
        
        .close-btn {
            font-size: 18px;
            cursor: pointer;
            color: white;
            opacity: 0.9;
            transition: opacity 0.2s ease;
        }
        
        .close-btn:hover {
            opacity: 1;
        }
        
        /* 主要内容区域 */
        .main-content {
            padding: var(--space-6) var(--space-4);
            text-align: center;
            color: white;
        }
        
        .invite-hero {
            margin-bottom: var(--space-8);
        }
        
        .invite-icon {
            width: 80px;
            height: 80px;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto var(--space-4);
            font-size: 36px;
            color: white;
            border: 3px solid rgba(255, 255, 255, 0.3);
        }
        
        .invite-title {
            font-size: 24px;
            font-weight: 600;
            margin-bottom: var(--space-3);
            color: white;
        }
        
        .invite-subtitle {
            font-size: 16px;
            opacity: 0.9;
            margin-bottom: var(--space-6);
            line-height: 1.5;
        }
        
        /* 奖励卡片 */
        .reward-card {
            background: rgba(255, 255, 255, 0.15);
            border-radius: var(--border-radius-large);
            padding: var(--space-6);
            margin-bottom: var(--space-8);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
        }
        
        .reward-title {
            font-size: 18px;
            font-weight: 600;
            margin-bottom: var(--space-4);
            color: white;
        }
        
        .reward-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: var(--space-4);
        }
        
        .reward-item {
            text-align: center;
            padding: var(--space-4);
            background: rgba(255, 255, 255, 0.1);
            border-radius: var(--border-radius-medium);
            border: 1px solid rgba(255, 255, 255, 0.2);
        }
        
        .reward-amount {
            font-size: 24px;
            font-weight: 700;
            color: #ffffff;
            margin-bottom: var(--space-2);
        }
        
        .reward-label {
            font-size: 14px;
            opacity: 0.9;
        }
        
        /* 邀请规则 */
        .rules-card {
            background: rgba(255, 255, 255, 0.1);
            border-radius: var(--border-radius-large);
            padding: var(--space-5);
            margin-bottom: var(--space-8);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
        }
        
        .rules-title {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: var(--space-4);
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .rules-title i {
            margin-right: var(--space-2);
            color: #ffffff;
        }
        
        .rules-list {
            text-align: left;
        }
        
        .rule-item {
            display: flex;
            align-items: flex-start;
            margin-bottom: var(--space-3);
            font-size: 14px;
            line-height: 1.5;
        }
        
        .rule-item:last-child {
            margin-bottom: 0;
        }
        
        .rule-number {
            width: 20px;
            height: 20px;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            font-weight: 600;
            margin-right: var(--space-3);
            flex-shrink: 0;
            margin-top: 2px;
        }
        
        .rule-text {
            flex: 1;
            opacity: 0.9;
        }
        
        /* 邀请按钮 */
        .invite-actions {
            display: flex;
            flex-direction: column;
            gap: var(--space-4);
        }
        
        .invite-btn {
            padding: var(--space-4) var(--space-6);
            border-radius: var(--border-radius-large);
            border: none;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: var(--space-2);
            text-decoration: none;
            color: white;
        }
        
        .invite-btn-primary {
            background: rgba(255, 255, 255, 0.9);
            color: var(--primary-color);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }
        
        .invite-btn-primary:hover {
            background: white;
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
        }
        
        .invite-btn-secondary {
            background: rgba(255, 255, 255, 0.2);
            border: 2px solid rgba(255, 255, 255, 0.4);
        }
        
        .invite-btn-secondary:hover {
            background: rgba(255, 255, 255, 0.3);
            border-color: rgba(255, 255, 255, 0.6);
        }
        
        /* 底部装饰 */
        .bottom-decoration {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            height: 100px;
            background: linear-gradient(to top, rgba(0, 0, 0, 0.1), transparent);
            pointer-events: none;
        }
        
        /* 响应式设计 */
        @media (max-width: 480px) {
            .main-content {
                padding: var(--space-4);
            }
            
            .invite-title {
                font-size: 20px;
            }
            
            .invite-subtitle {
                font-size: 14px;
            }
            
            .reward-grid {
                grid-template-columns: 1fr;
                gap: var(--space-3);
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <!-- 头部区域 -->
        <div class="header">
            <div class="top-bar">
                <div class="back-btn" onclick="history.back()">
                    <i class="fas fa-arrow-left"></i>
                </div>
                <div class="page-title">邀请好友</div>
                <div class="close-btn" onclick="closePage()">
                    <i class="fas fa-times"></i>
                </div>
            </div>
        </div>
        
        <!-- 主要内容 -->
        <div class="main-content">
            <!-- 邀请英雄区域 -->
            <div class="invite-hero">
                <div class="invite-icon">
                    <i class="fas fa-gift"></i>
                </div>
                <h1 class="invite-title">邀请好友赚积分</h1>
                <p class="invite-subtitle">
                    推荐好友注册并完成个人认证<br>
                    即可获得丰厚积分奖励
                </p>
            </div>
            
            <!-- 奖励卡片 -->
            <div class="reward-card">
                <h2 class="reward-title">邀请奖励</h2>
                <div class="reward-grid">
                    <div class="reward-item">
                        <div class="reward-amount">100</div>
                        <div class="reward-label">积分/人</div>
                    </div>
                    <div class="reward-item">
                        <div class="reward-amount">无上限</div>
                        <div class="reward-label">邀请人数</div>
                    </div>
                </div>
            </div>
            
            <!-- 邀请规则 -->
            <div class="rules-card">
                <h3 class="rules-title">
                    <i class="fas fa-list-ol"></i>
                    邀请规则
                </h3>
                <div class="rules-list">
                    <div class="rule-item">
                        <div class="rule-number">1</div>
                        <div class="rule-text">分享邀请链接给好友</div>
                    </div>
                    <div class="rule-item">
                        <div class="rule-number">2</div>
                        <div class="rule-text">好友通过链接注册小程序</div>
                    </div>
                    <div class="rule-item">
                        <div class="rule-number">3</div>
                        <div class="rule-text">好友完成个人认证</div>
                    </div>
                    <div class="rule-item">
                        <div class="rule-number">4</div>
                        <div class="rule-text">您立即获得100积分奖励</div>
                    </div>
                </div>
            </div>
            
            <!-- 邀请按钮 -->
            <div class="invite-actions">
                <button class="invite-btn invite-btn-primary" onclick="shareToWechat()">
                    <i class="fas fa-share"></i>
                    立即邀请好友
                </button>
            </div>
        </div>
        
        <!-- 底部装饰 -->
        <div class="bottom-decoration"></div>
    </div>
    
    <script>
        // 分享到微信
        function shareToWechat() {
            // 检查是否在微信环境中
            if (typeof WeixinJSBridge !== 'undefined') {
                WeixinJSBridge.invoke('shareTimeline', {
                    title: '模切材料小程序 - 邀请好友赚积分',
                    link: 'https://b2b.com/invite/abc123',
                    imgUrl: 'https://b2b.com/images/share-logo.png',
                    success: function() {
                        showToast('分享成功！');
                    },
                    cancel: function() {
                        showToast('分享已取消');
                    }
                });
            } else {
                // 非微信环境，使用Web Share API
                if (navigator.share) {
                    navigator.share({
                        title: '模切材料小程序 - 邀请好友赚积分',
                        text: '推荐好友注册并完成个人认证，即可获得100积分奖励！',
                        url: 'https://b2b.com/invite/abc123'
                    }).then(() => {
                        showToast('分享成功！');
                    }).catch(() => {
                        showToast('分享失败');
                    });
                } else {
                    // 降级处理，复制链接
                    copyInviteLink();
                }
            }
        }
        
        // 复制邀请链接
        function copyInviteLink() {
            const inviteLink = 'https://b2b.com/invite/abc123';
            
            if (navigator.clipboard) {
                navigator.clipboard.writeText(inviteLink).then(() => {
                    showToast('邀请链接已复制到剪贴板');
                }).catch(() => {
                    fallbackCopy(inviteLink);
                });
            } else {
                fallbackCopy(inviteLink);
            }
        }
        
        // 降级复制方法
        function fallbackCopy(text) {
            const textArea = document.createElement('textarea');
            textArea.value = text;
            textArea.style.position = 'fixed';
            textArea.style.left = '-999999px';
            textArea.style.top = '-999999px';
            document.body.appendChild(textArea);
            textArea.focus();
            textArea.select();
            
            try {
                document.execCommand('copy');
                showToast('邀请链接已复制到剪贴板');
            } catch (err) {
                showToast('复制失败，请手动复制');
            }
            
            document.body.removeChild(textArea);
        }
        
        // 关闭页面
        function closePage() {
            if (window.history.length > 1) {
                history.back();
            } else {
                window.close();
            }
        }
        
        // 显示提示信息
        function showToast(message) {
            // 创建提示元素
            const toast = document.createElement('div');
            toast.textContent = message;
            toast.style.cssText = `
                position: fixed;
                top: 50%;
                left: 50%;
                transform: translate(-50%, -50%);
                background: rgba(0, 0, 0, 0.8);
                color: white;
                padding: 12px 24px;
                border-radius: 6px;
                font-size: 14px;
                z-index: 9999;
                pointer-events: none;
            `;
            
            document.body.appendChild(toast);
            
            // 3秒后移除
            setTimeout(() => {
                if (toast.parentNode) {
                    toast.parentNode.removeChild(toast);
                }
            }, 3000);
        }
        
        // 按钮点击效果
        document.querySelectorAll('.invite-btn').forEach(btn => {
            btn.addEventListener('click', function() {
                this.style.transform = 'scale(0.95)';
                setTimeout(() => {
                    this.style.transform = '';
                }, 150);
            });
        });
        
        // 页面加载完成后的动画
        window.addEventListener('load', function() {
            const elements = document.querySelectorAll('.invite-hero, .reward-card, .rules-card, .invite-actions');
            elements.forEach((el, index) => {
                el.style.opacity = '0';
                el.style.transform = 'translateY(20px)';
                el.style.transition = 'all 0.6s ease';
                
                setTimeout(() => {
                    el.style.opacity = '1';
                    el.style.transform = 'translateY(0)';
                }, index * 200);
            });
        });
    </script>
</body>
</html>

